<template>
  <div class="dialog">
    <el-dialog
      title="详情"
      :modal-append-to-body="true"
      :append-to-body="true"
      :close-on-click-modal="true"
      :visible.sync="showDialog"
      width="60%"
      custom-class="showDialog"
      class="showDialog"
      @close="close"
    >
      <div
        v-for="items,index in detailItem.list"
        :key="index"
      >
        <li
          v-if="items.featuresDescribe"
          class="title"
          :title="items.featuresDescribe"
        >
          特征{{ index + 1 }}
        </li>

        <li
          v-if="items.featuresDescribe"
          class="describe"
          :title="items.featuresDescribe"
        >
          特征描述：<br /> {{ items.featuresDescribe }}
          <!-- <span @click="showDetail(item)">详情</span> -->
        </li>
        <li
          v-if="items.featuresImageIdList"
          class="img"
          :title="items.featuresDescribe"
        >
          <img
            v-for="item,indexs in items.featuresImageIdList"
            :key="indexs"
            :src="'data:image/jpeg;base64,'
              + item.data"
            alt=""
            @click="imageUrl(item.data)"
          />
        </li>
        <li
          v-if="items.proposalWork"
          class="describe"
          :title="items.proposalWork"
        >
          农事描述：<br /> {{ items.proposalWork }}
        </li>
        <li
          v-if="items.workImageIdList"
          class="img"
          :title="items.proposalWork"
        >
          <img
            v-for="item,indexs in items.workImageIdList"
            :key="indexs"
            :src="'data:image/jpeg;base64,'
              + item.data"
            alt=""
            @click="imageUrl(item.data)"
          />
        </li>
        <li
          v-if="items.note"
          class="describe"
          :title="items.note"
        >
          注意事项描述：<br /> {{ items.note }}
          <!-- <span @click="showDetail(item)">详情</span> -->
        </li>
        <li
          v-if="items.noteImageIdList"
          class="img"
        >
          <img
            v-for="item,indexs in items.noteImageIdList"
            :key="indexs"
            :src="'data:image/jpeg;base64,'
              + item.data"
            alt=""
            @click="imageUrl(item.data)"
          />
        </li>
        <li
          v-if="items.pestName"
          class="title"
          :title="items.pestName"
        >
          虫害名称：{{ items.pestName }}
        </li>
        <li
          v-if="items.diseaseName"
          class="title"
          :title="items.diseaseName"
        >
          病害名称：{{ items.diseaseName }}
        </li>
        <li
          v-if="items.pestDescribe"
          class="describe"
          :title="items.pestDescribe"
        >
          虫害描述：<br /> {{ items.pestDescribe }}
        </li>
        <li
          v-if="items.pestImageList"
          class="img"
          :title="items.pestDescribe"
        >
          <img
            v-for="item,indexs in items.pestImageList"
            :key="indexs"
            :src="'data:image/jpeg;base64,'
              + item.data"
            alt=""
            @click="imageUrl(item.data)"
          />
        </li>
        <li
          v-if="items.diseaseDescribe"
          class="describe"
          :title="items.diseaseDescribe"
        >
          病害描述：<br /> {{ items.diseaseDescribe }}
        </li>
        <li
          v-if="items.diseaseImageList"
          class="img"
          :title="items.featuresDescribe"
        >
          <img
            v-for="item,indexs in items.diseaseImageList"
            :key="indexs"
            :src="'data:image/jpeg;base64,'
              + item.data"
            alt=""
            @click="imageUrl(item.data)"
          />
        </li>
        <li
          v-if="items.handle"
          class="describe"
          :title="items.handle"
        >
          建议处理方法：<br /> {{ items.handle }}
        </li>
      </div>
      <!-- <div>{{ detailItem.content }}</div>
      <img
        v-for="(item, index) in pictureSrcList"
        :key="index"
        :src="
          item.pictureContent
            ? 'data:image/jpeg;base64,' + item.pictureContent
            : ''
        "
        class="img-src"
        alt=""
      /> -->
    </el-dialog>
    <el-dialog
      title="查看大图"
      :visible.sync="showImgDialog"
      :modal-append-to-body="true"
      :append-to-body="true"
      :close-on-click-modal="true"
      custom-class="showImg"
      width="30%"
      class="showImg"
    >
      <img
        style="max-width:100%;width:100%"
        :src="'data:image/jpeg;base64,'
          + imgurl"
        alt=""
      />
    </el-dialog>
  </div>
</template>

<script>
// import conApi from "@/api/digital-production/conservation-model/configuration/index";

export default {
  name: "",
  components: {},
  props: {
    show: {
      type: Boolean,
      default: false
    },
    detailItem: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  data() {
    return {
      showDialog: this.show,
      pictureSrcList: [],
      imgurl: "",
      showImgDialog: false
    };
  },
  watch: {
    show(v) {
      this.showDialog = v;
    },
    detailItem(v) {
      // this.queryByPicture(v);
    }
  },
  created() {},
  mounted() {},
  methods: {
    // 查询图片
    // queryByPicture(data) {
    //   let pictureIdList = [];
    //   data.pictureList.forEach((element) => {
    //     pictureIdList.push(element[0]);
    //   });
    //   conApi.queryByPicture({ pictureId: pictureIdList }).then((res) => {
    //     if (res.code === 1) {
    //       let data = res.data || [];
    //       this.pictureSrcList = data;
    //     } else {
    //       this.$message.error(res.msg);
    //     }
    //   });
    // },
    close() {
      this.$emit("closeDialog");
    },
    imageUrl(e) {
      this.imgurl = e;
      this.showImgDialog = true;
    }
  }
};
</script>

<style lang="scss">
.img-src {
  max-width: 100%;
}
.img {
  margin: 20px 10px;
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  img {
    margin: 10px;
    height: 200px;
    width: auto;
  }
}
.describe {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  line-height: 24px;
  margin-bottom: 20px;
}
.title {
  font-size: 22px;
  font-weight: 800;
  line-height: 35px;
  letter-spacing: 2px;
}
li {
  list-style-type: none;
}
.showImg {
  min-width: 60%;
  min-height: 74%;
  .el-dialog {
    .el-dialog__body {
      min-height: 65%;
      // max-height: 65%;
    }
  }
  // 弹出框  统一样式
}
.showDialog {
  // background-color: rgba(124, 143, 143, 0.6);

  .el-dialog {
    background-color: rgba(240, 243, 247, 1);
    // width: 55% !important;
    min-width: 55%;
    border: #000 1px solid;
    border-radius: 9px;
    overflow: hidden;
    color: #000;

    .el-dialog__header {
      width: 100%;
      background-color: rgba(0, 110, 145, 1);
      padding: 15px;
      color: #fff;

      .el-dialog__title {
        font-weight: 700;
        color: #fff;
      }

      .el-dialog__close {
        font-size: 22px;
        color: #fff;
        font-weight: 700;
      }
    }

    .el-dialog__body {
      // overflow: hidden;
      height: 70vh;
      overflow-y: auto;
      .el-input__inner {
        color: #000;
        border-color: rgba(217, 217, 217, 1);
        background-color: rgba(255, 255, 255, 1);
      }

      .el-textarea__inner {
        color: #000;
        border-color: rgba(217, 217, 217, 1);
        background-color: rgba(255, 255, 255, 1);
      }

      .el-form {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;

        .total-price {
          color: #000;
        }

        .el-row {
          width: 100%;
          margin-bottom: 10px;

          .el-table {
            max-height: 200px;
            overflow-y: auto;
            background-color: rgba(255, 255, 255, 1);

            .cell {
              color: #000;
            }

            th {
              background-color: rgba(230, 230, 230, 1);
            }

            th.is-leaf {
              border-color: rgba(77, 77, 77, 1);
            }

            td {
              border-color: rgba(77, 77, 77, 1);
            }

            tr:hover {
              background-color: rgba(77, 77, 77, 1);
            }

            .el-table__empty-text {
              color: #000;
            }

            .current-row {
              // background-color: rgb(177, 177, 177);
              background-color: #dbdbdb !important;
            }

            .el-table__row--striped {
              background-color: rgba(255, 255, 255, 1);
            }

            // color: #000;
          }

          .el-table--border {
            border-color: rgba(77, 77, 77, 1);
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
          }

          .el-table--enable-row-hover .el-table__body tr:hover > td {
            background-color: rgb(177, 177, 177);
          }

          .el-table__body tr.current-row > td {
            background-color: #dbdbdb !important;
          }

          // .el-button {
          //   width: 100%;
          // }
          .el-form {
            // width: 100%;
            // margin: ;
            .el-form-item {
              margin-bottom: 0 !important;
            }

            .el-form-item__content {
              display: flex;
              width: 100%;

              .el-select {
                min-width: 15%;
              }

              .el-input {
                min-width: 10%;
              }

              .el-input__inner {
                border-right: none;
              }

              .el-button {
                min-width: 5%;
                margin-left: 10px;
              }
            }
          }
        }

        .el-form-item {
          display: flex;
          align-items: flex-start;

          .el-form-item__label {
            line-height: 36px;
            min-width: 120px;
            text-align: end;
          }

          .el-form-item__content {
            line-height: 36px;
            width: 100%;
            display: flex;
            // flex-direction: row;
            flex-wrap: wrap;
          }
        }
      }
    }

    .el-dialog__footer {
      width: 100%;
      border-top: 1px solid rgba(191, 191, 191, 1);
      position: inherit;
      text-align: right;
      padding: 15px;
    }

    .el-form-item__label {
      color: #000;
      font-weight: 400;
      font-size: 16px;
    }
  }
}
</style>
